package kr.hkit.androidcomplete02.ch17;

import kr.hkit.androidcomplete02.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class ApplicationTest extends Activity {
	static final String TAG = "APPLICATION";
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch18_applicationtest);
		updateNowMode();
	}
	
	private void updateNowMode() {
		TextView tv = (TextView) findViewById(R.id.ch18_application_mode);
		ApplicationEx app = (ApplicationEx) getApplication();
		if(app.getmMode() == ApplicationEx.BEGINNER){
			tv.setText("현재 모드 : 초보자 모드");
		} else {
			tv.setText("현재 모드 : 숙련자 모드");
		}
	}

	public void mOnClick(View v){
		ApplicationEx app = (ApplicationEx) getApplication();
		
		switch(v.getId()){
		case R.id.ch18_application_beginner:
			app.setmMode(ApplicationEx.BEGINNER);
			break;
		case R.id.ch18_application_professional:
			app.setmMode(ApplicationEx.PREFESSIONAL);
			break;
		}
		updateNowMode();
	}
}
